<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">
<%if (request.getSession().getAttribute("username") == null) {
            response.sendRedirect("login.jsp");
}%>
<%@ page import="java.sql.*"%>
<%@ page import="javax.servlet.http.HttpSession;"%>
<%@ page import="helper.ConnectionHelper"%>
<%
            String name = "";
            String fname = "";
            String lname = "";
            Boolean gender = null;
            String address = "";
            String username =  (String)request.getSession().getAttribute("username");
            String s = "select * from Users where UserName = '"+username+"'";
            Connection con = ConnectionHelper.GetConnection();
            Statement p = con.createStatement();
            ResultSet rs = p.executeQuery(s);
            while(rs.next()){
             name = rs.getString(1);
             fname = rs.getString(3);
             lname = rs.getString(4);
             gender = rs.getBoolean(5);
             address = rs.getString(6);
            }
%>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/clientTemplate.css">
        <title>Client Template</title>
    </head>
    <body>
        <center>
        <table id="tableClientTemplate">
            <tr id="headerClientTemplate">
                <td><%@include file="clientHeader.jsp" %></td>
            </tr>
            <tr id="middleClientTemplate">
                <td>

                    <center><form id="form1" name="form1" method="post" action="viewProfileServlet">
    <table width="200" border="0" align="center">
    <tr>
      <td><center><h2>Profile Details</h2></center></td>
    </tr>
  </table>
  <table width="600" border="0" align="center">
    <tr>
      <td width="170" align="left"><strong>Username:</strong></td>
      <td width="420" align="left"><label for="txtaddress"></label>
          <input name="txtusername" type="text" id="textfield4" value="<%=name %>" readonly="readonly" /></td>
    </tr>
    <tr>
      <td align="left"><strong>First name:</strong></td>
      <td align="left"><label for="txtregdate"></label>
      <input name="txtfname" type="text" id="textfield5" value="<%=fname %>" readonly="readonly" /></td>
    </tr>
    <tr>
      <td align="left"><strong>Last name:</strong></td>
      <td align="left"><label for="txtactdate"></label>
        <label for="textfield10"></label>
      <input name="txtlname" type="text" id="textfield10" value="<%=lname %>" readonly="readonly" /></td>
    </tr>
    <tr>
      <td align="left"><strong>Gender:</strong></td>
      <td align="left"><p>
        <label>
            <input name="RadioGroup1" type="radio" id="RadioGroup1_0" value="true" disabled="disabled" />
          Male</label>
        <br />
        <label>
            <input type="radio" name="RadioGroup1" value="false" id="RadioGroup1_1" disabled="disabled" />
          Female</label>
        <br />
      </p></td>
    </tr>
    <tr>
      <td align="left"><strong>Address:</strong></td>
      <td align="left"><label for="txtaddress"></label>
          <textarea name="txtaddress" cols="45" rows="5" readonly="readonly" id="txtaddress"><%=address %></textarea>        <label for="textfield7"></label></td>
    </tr>
    <tr>
      <td align="left">&nbsp;</td>
      <td align="left"><input type="submit" name="edit" id="edit" value="Edit Profile Details"/></td>
    </tr>
  </table>
    </form></center>

                </td>
            </tr>
            <tr id="footerClientTemplate">
                <td><%@include file="clientFooter.jsp" %></td>
            </tr>
        </table>
        </center>
                
    </body>
</html>
